import 'package:flutter/material.dart';
import 'package:flutter_psj/ui/particle/particle_page.dart';
import 'package:flutter_psj/ui/particle/particle_weight.dart';
import 'package:get/get.dart';

import 'logic.dart';

class LoginPage extends GetView<LoginLogic> {
  final logic = Get.find<LoginLogic>();
  final state = Get.find<LoginLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('登录')),
      body: Stack(
        children: [
          const Positioned.fill(child: AnimatedBackGround()),
          Positioned.fill(
              child: InkWell(
            child: const ParticlesWidget(30),
            onTap: () {
              FocusScope.of(context).requestFocus(FocusNode());
            },
          )),
          Positioned.fill(
            child: Center(
                child: Card(
              elevation: 5.0,
              color: Colors.white,
              shape: const RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(10.0))),
              margin: const EdgeInsets.only(left: 30, right: 30),
              child: Padding(
                padding: const EdgeInsets.fromLTRB(30, 40, 30, 0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    TextFormField(
                      controller: state.userController,
                      decoration: const InputDecoration(
                          icon: Icon(Icons.account_circle),
                          labelText: "用户名",
                          hintText: "请输入用户名"),
                    ),
                    const Padding(padding: EdgeInsets.all(10)),
                    TextFormField(
                      controller: state.pwController,
                      obscureText: true,
                      decoration: const InputDecoration(
                          icon: Icon(Icons.password),
                          labelText: "密码",
                          hintText: "请输入密码"),
                    ),
                    const Padding(padding: EdgeInsets.all(10)),
                  ],
                ),
              ),
            )),
          )
        ],
      ),
    );
  }
}
